<?php
namespace app\admin\controller;

use think\Db;
use think\Request;
use think\Session;
use think\Cache;
use think\Controller;
use think\captcha\Captcha;

class Video extends Common
{

    public function get_actor_list()
    {

        $count = Db::name('actor')->field('*')->count();
        if ($count > 0) {
            $list = Db::name('actor')->field('id,name')->select();
            foreach ($list as $k => $v) {
                $list[$k]['value'] = $v['id'];
            }
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);

        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    public function get_director_list()
    {

        $count = Db::name('director')->field('*')->count();
        if ($count > 0) {
            $list = Db::name('director')->field('id,name')->select();
            foreach ($list as $k => $v) {
                $list[$k]['value'] = $v['id'];
            }
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);

        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    public function get_tag_list1()
    {
        $where = array();
        $where[] = array('status', 'eq', 1);
        $count = Db::name('video_tag')->field('*')->where($where)->count();
        if ($count > 0) {
            $list = Db::name('video_tag')->field('*')->where($where)->select();
            foreach ($list as $k => $v) {
                $list[$k]['value'] = $list[$k]['id'];
                $list[$k]['disabled'] = '';
                $list[$k]['selected'] = '';
            }
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);
        } else {
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = array();
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);
            //$data='{"code":"1","msg":"没有数据"}';
        }

        echo $data;
    }

    public function get_tag_list()
    {

        $count = Db::name('video_tag')->field('*')->count();
        if ($count > 0) {
            $list = Db::name('video_tag')->field('*')->select();
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);

        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    public function get_video_time_list()
    {
        $count = Db::name('video_time')->field('*')->count();
        if ($count > 0) {
            $list = Db::name('video_time')->field('*')->select();
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);

        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    public function get_video_time_list1()
    {
        $user_re=Db::name('user')->field('column_id')->where(array('id'=>session('qm_ad_uid'),'type'=>2))->find();
        if($user_re){
            $column_id=$user_re['column_id'];
            $where = array();
            if ($column_id && $column_id>0) {
                $where[] = array('column_id','eq', $column_id);
                $where[] = array('status','eq', 1);
                $count = Db::name('video_time')->field('*')->where($where)->count();
                if ($count > 0) {
                    $list = Db::name('video_time')->field('id as value,start_time as name')->where($where)->select();
                    foreach ($list as $k => $v) {
                        $list[$k]['disabled'] = '';
                        $list[$k]['selected'] = '';
                        if (input('video_time_id')) {
                            if ($v['value'] == input('video_time_id')) {
                                $list[$k]['selected'] = true;
                            }
                        }
                    }
                    $result['code'] = 0;
                    $result['msg'] = 'ok';
                    $result['count'] = $count;

                    $result['data'] = $list;
                    $data = json_encode($result);
                    $data = str_replace('null', '""', $data);
                } else {
                    $result['code'] = 0;
                    $result['msg'] = 'ok';
                    $result['count'] = $count;
                    $result['data'] = array();
                    $data = json_encode($result);
                    $data = str_replace('null', '""', $data);
                    //$data='{"code":"1","msg":"没有数据"}';
                }
            } else {
                $result['code'] = 0;
                $result['msg'] = 'ok';
                $result['data'] = array();
                $data = json_encode($result);
                $data = str_replace('null', '""', $data);
            }
        }else{
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['data'] = array();
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);
        }

        echo $data;
    }
    public function get_small_cate_list()
    {
        $count = Db::name('video_small_cate')->field('*')->count();
        if ($count > 0) {
            $list = Db::name('video_small_cate')->field('*')->select();
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);

        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    public function get_small_cate_list1()
    {
        $user_re=Db::name('user')->field('column_id')->where(array('id'=>session('qm_ad_uid'),'type'=>2))->find();
        if($user_re){
            $column_id=$user_re['column_id'];
            $where = array();
            if ($column_id && $column_id>0) {
                $where[] = array('column_id','eq', $column_id);
                $where[] = array('status','eq', 1);
                $count = Db::name('video_small_cate')->field('*')->where($where)->count();
                if ($count > 0) {
                    $list = Db::name('video_small_cate')->field('id as value,name')->where($where)->select();
                    foreach ($list as $k => $v) {
                        $list[$k]['disabled'] = '';
                        $list[$k]['selected'] = '';
                        if (input('cate_id')) {
                            if ($v['value'] == input('cate_id')) {
                                $list[$k]['selected'] = true;
                            }
                        }
                    }
                    $result['code'] = 0;
                    $result['msg'] = 'ok';
                    $result['count'] = $count;

                    $result['data'] = $list;
                    $data = json_encode($result);
                    $data = str_replace('null', '""', $data);
                } else {
                    $result['code'] = 0;
                    $result['msg'] = 'ok';
                    $result['count'] = $count;

                    $result['data'] = array();
                    $data = json_encode($result);
                    $data = str_replace('null', '""', $data);
                    //$data='{"code":"1","msg":"没有数据"}';
                }
            } else {
                $result['code'] = 0;
                $result['msg'] = 'ok';
                $result['data'] = array();
                $data = json_encode($result);
                $data = str_replace('null', '""', $data);
            }
        }else{
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['data'] = array();
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);
        }
        echo $data;
    }

    public function get_address_list()
    {
        $count = Db::name('video_address')->field('*')->count();
        if ($count > 0) {
            $list = Db::name('video_address')->field('*')->select();
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['count'] = $count;

            $result['data'] = $list;
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);

        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    public function get_address_list1()
    {
        $user_re=Db::name('user')->field('column_id')->where(array('id'=>session('qm_ad_uid'),'type'=>2))->find();
        if($user_re){
            $column_id=$user_re['column_id'];
            $where = array();
            if ($column_id && $column_id>0) {
                $where[] = array('column_id','eq', $column_id);
                $where[] = array('status','eq', 1);
                $count = Db::name('video_address')->field('*')->where($where)->count();
                if ($count > 0) {
                    $list = Db::name('video_address')->field('id as value,name')->where($where)->select();
                    foreach ($list as $k => $v) {
                        $list[$k]['disabled'] = '';
                        $list[$k]['selected'] = '';
                        if (input('address_id')) {
                            if ($v['value'] == input('address_id')) {
                                $list[$k]['selected'] = true;
                            }
                        }
                    }
                    $result['code'] = 0;
                    $result['msg'] = 'ok';
                    $result['count'] = $count;

                    $result['data'] = $list;
                    $data = json_encode($result);
                    $data = str_replace('null', '""', $data);
                } else {
                    $result['code'] = 0;
                    $result['msg'] = 'ok';
                    $result['count'] = $count;

                    $result['data'] = array();
                    $data = json_encode($result);
                    $data = str_replace('null', '""', $data);
                    //$data='{"code":"1","msg":"没有数据"}';
                }
            } else {
                $result['code'] = 0;
                $result['msg'] = 'ok';
                $result['data'] = array();
                $data = json_encode($result);
                $data = str_replace('null', '""', $data);
            }
        }else{
            $result['code'] = 0;
            $result['msg'] = 'ok';
            $result['data'] = array();
            $data = json_encode($result);
            $data = str_replace('null', '""', $data);
        }
        echo $data;
    }

    public function get_small_column_list()
    {
        $user_re=Db::name('user')->field('column_id')->where(array('id'=>session('qm_ad_uid'),'type'=>2))->find();
        if($user_re){
            $count = Db::name('video_small_column')->field('*')->where('id',$user_re['column_id'])->count();
            if ($count > 0) {
                $list = Db::name('video_small_column')->field('*')->where('id',$user_re['column_id'])->select();
                $result['code'] = 0;
                $result['msg'] = 'ok';
                $result['count'] = $count;

                $result['data'] = $list;
                $data = json_encode($result);
                $data = str_replace('null', '""', $data);

            } else {
                $data = '{"errcode":"1","msg":"没有数据"}';
            }
        }else{
            $data = '{"errcode":"1","msg":"没有数据"}';
        }

        echo $data;
    }

    //视频列表
    public function video_small()
    {
        $p = input('page') ? input('page') : 1;
        $pagesize = input('limit') ? input('limit') : 10;
        $start = ($p - 1) * $pagesize;
        $where = array();
        $where[] = array('uid', 'eq', session('qm_ad_uid'));
        if (input('id')) {
            $where[] = array('id', 'eq', input('id'));
        }
        if (input('cate_id')) {
            $where[] = array('cate_id', 'eq', input('cate_id'));
        }
        if (input('column_id')) {
            $where[] = array('column_id', 'eq', input('column_id'));
        }
        if (input('address_id')) {
            $where[] = array('address_id', 'eq', input('address_id'));
        }
        if (input('video_time_id')) {
            $where[] = array('video_time_id', 'eq', input('video_time_id'));
        }
        if (input('report_num')) {
            if (input('report_num') == 2) {
                $where[] = array('report_num', 'gt', 0);
            } else {
                $where[] = array('report_num', 'eq', 0);
            }
        }
        if (input('status')) {
            $where[] = array('status', 'eq', input('status'));
        }
        if (input('title')) {
            $where[] = array('title', 'like', '%' . input('title') . '%');
        }
        $count = Db::name('video_small')->field('*')->where($where)->count();
        if ($count > 0) {
            $pagenum = ceil($count / $pagesize);
            if ($p <= $pagenum) {
                $list = Db::name('video_small')->field('*')->limit($start, $pagesize)->where($where)->order('id desc')->select();
                foreach ($list as $k => $v) {
                    $time_long_arr=explode(':',$v['video_time']);
                    if(count($time_long_arr)>2){
                        $list[$k]['video_time']=$time_long_arr[0]*60+$time_long_arr[1].':'.$time_long_arr[2];
                    }
                    $list[$k]['http'] = VIDEO_PATH;
                    $list[$k]['createtime'] = date('Y-m-d H:i:s', $list[$k]['createtime']);
                    if ($list[$k]['time_free']) {
                        $list[$k]['time_free'] = date('Y-m-d H:i:s', $list[$k]['time_free']);
                    } else {
                        $list[$k]['time_free'] = '';
                    }

                    $list[$k]['cate_name'] = '';
                    $cate_re = Db::name('video_small_cate')->field('name')->where(array('id' => $list[$k]['cate_id']))->find();
                    if ($cate_re) {
                        $list[$k]['cate_name'] = $cate_re['name'];
                    }
                    $user_re = Db::name('user')->field('name')->where(array('id' => $list[$k]['uid']))->find();
                    $list[$k]['author'] = $user_re['name'];
                }
                $result['code'] = 0;
                $result['msg'] = 'ok';
                $result['count'] = $count;

                $result['data'] = $list;
                $data = json_encode($result);
                $data = str_replace('null', '""', $data);
            } else {
                $result['code'] = 1;
                $result['msg'] = '超出最大页数';
                $data = json_encode($result);
                $data = str_replace('null', '""', $data);
            }
        } else {
            $data = '{"errcode":"1","msg":"没有数据"}';
        }
        echo $data;
    }

    //添加视频
    public function add_video_small()
    {
        if (request()->isPost()) {
            $tag_arr = input('tag');
            $tag = '';
            if ($tag_arr) {
                foreach ($tag_arr as $k => $v) {
                    $tag .= $k . ',';
                }
                $tag = substr($tag, 0, -1);
            }
            $title = input('post.title');
            $rec_title = input('post.rec_title');
            $memo = input('post.memo');
            $address_id = input('post.address_id');
            $video_time_id = input('post.video_time_id');
            $time_free = input('post.time_free');
            $language = input('post.language');
            $m3u8_time = input('post.m3u8_time')?input('post.m3u8_time'):10;
            $vip_status = input('post.vip_status') ? input('post.vip_status') : 2;
            if ($vip_status == 'on') {
                $vip_status = 1;
            } else {
                $vip_status = 2;
            }
            $uid = session('qm_ad_uid');
            $url = input('post.url');
            $cate_id = input('post.cate_id_str');
            $sort = input('post.sort')?input('post.sort'):1;
            $video_time = input('post.video_time');
            $fm_img = input('post.fm_img') ? input('post.fm_img') : '';
            $rec_fm_img = input('post.rec_fm_img') ? input('post.rec_fm_img') : '';

            $status = input('post.status') ? input('post.status') : 2;
            if ($status == 'on') {
                $status = 1;
            }
            $recommend_status = input('post.recommend_status') ? input('post.recommend_status') : 2;
            if ($recommend_status == 'on') {
                $recommend_status = 1;
            }
            $access_token = input('post.access_token');
            $index = new \app\admin\model\Index();
            $upload = new \app\admin\model\Upload();

            if (!$title) {
                $result['code'] = 1;
                $result['msg'] = '标题不能为空';
            } elseif (!$cate_id) {
                $result['code'] = 1;
                $result['msg'] = '视频分类不能为空';
            } elseif (!$url) {
                $result['code'] = 1;
                $result['msg'] = '视频未上传';
            } else {
                if (!$fm_img || $fm_img == '') {
                    $result['code'] = 1;
                    $result['msg'] = '未上传封面图片';
                } elseif (strtotime($time_free) > time() && (!$rec_title || $rec_title == '')) {
                    $result['code'] = 1;
                    $result['msg'] = '未填写限时推荐标题';
                } elseif (strtotime($time_free) > time() && (!$rec_fm_img || $rec_fm_img == '')) {
                    $result['code'] = 1;
                    $result['msg'] = '未上传限时推荐封面图片';
                } else {
                    $name_re = Db::name('video_small')->field('id')->where(array('title' => $title))->find();
                    if ($name_re) {
                        $result['code'] = 1;
                        $result['msg'] = '标题已存在';
                    } else {
                        $editor_status = 2;
                        if ($uid) {
                            $user_re = Db::name('user')->field('name,path,type,column_id')->where(array('id' => $uid))->find();
                            if($user_re && $user_re['type']==2){
                                $editor_status=1;
                                $author_str = $user_re['name'];
                                $path_str = $user_re['path'];
                            }
                            if ($editor_status == 1) {
                                $arr = [
                                    'title' => $title,
                                    'rec_title' => $rec_title,
                                    'memo' => $memo,
                                    'column_id' => $user_re['column_id'],
                                    'address_id' => $address_id,
                                    'video_time_id' => $video_time_id,
                                    'tag' => $tag,
                                    'vip_status' => $vip_status,
                                    'language' => $language,
                                    'time_free' => strtotime($time_free),
                                    'uid' => $uid,
                                    'url' => $index->link_urldecode($url),
                                    'cate_id' => $cate_id,
                                    'status' => 2,
                                    'recommend_status' => $recommend_status,
                                    'fm_img' => $fm_img,
                                    'rec_fm_img' => $rec_fm_img,
                                    'video_time' => $video_time,
                                    'author' => $author_str,
                                    'author_path' => $path_str,
                                    'sort' => $sort,
                                    'video_id' => '',
                                    'createtime' => time(),
                                    'edit_time' => time(),
                                    'm3u8_time' => $m3u8_time,
                                ];
                                $res = Db::name('video_small')->insert($arr);
                                if ($res) {
                                    $result['code'] = 0;
                                    $result['msg'] = '添加视频成功';
                                    Db::name('user')->where('id', $uid)->setInc('video_num', 1);
                                } else {
                                    $upload->del_file('', $fm_img);
                                    $upload->del_file('', $rec_fm_img);
                                    $result['code'] = 1;
                                    $result['msg'] = '添加视频失败';
                                }
                            } else {
                                $result['code'] = 1;
                                $result['msg'] = '发布人不是编辑权限';
                            }
                        } else {
                            $result['code'] = 1;
                            $result['msg'] = '请登录';
                        }

                    }
                }

            }

        } else {
            $result['code'] = 1;
            $result['msg'] = '添加视频失败';
        }
        echo json_encode($result);
    }

    //修改视频
    public function edit_video_small()
    {
        if (request()->isPost()) {
            $title = input('post.title');
            $rec_title = input('post.rec_title');
            $memo = input('post.memo');
            $address_id = input('post.address_id');
            $video_time_id = input('post.video_time_id');
            $video_id = input('post.video_id');
            $time_free = input('post.time_free');
            $language = input('post.language');
            $m3u8_time = input('post.m3u8_time')?input('post.m3u8_time'):10;
            $tag_arr = input('tag');
            $tag = '';
            if ($tag_arr) {
                foreach ($tag_arr as $k => $v) {
                    $tag .= $k . ',';
                }
                $tag = substr($tag, 0, -1);
            }
            $vip_status = input('post.vip_status') ? input('post.vip_status') : 1;
            if ($vip_status == 'on') {
                $vip_status = 1;
            } else {
                $vip_status = 2;
            }
            $uid = session('qm_ad_uid');
            $index=new \app\admin\model\Index();
            $url = $index->link_urldecode(input('post.url'));
            $cate_id = input('post.cate_id_str');
            $video_time = input('post.video_time');
            $fm_img = input('post.fm_img') ? input('post.fm_img') : '';
            $rec_fm_img = input('post.rec_fm_img') ? input('post.rec_fm_img') : '';

            $sort = input('post.sort')?input('post.sort'):1;
            $recommend_status = input('post.recommend_status') ? input('post.recommend_status') : 2;
            if ($recommend_status == 'on') {
                $recommend_status = 1;
            }
            $status = input('post.status') ? input('post.status') : 2;
            if ($status == 'on') {
                $status = 1;
            }
            $id = input('post.id');
            $access_token = input('post.access_token');
            $upload = new \app\admin\model\Upload();
            if (!$title) {
                $result['code'] = 1;
                $result['msg'] = '标题不能为空';
            } else {
                $title_re = Db::name('video_small')->field('id')->where(array('title' => $title))->where('id!=' . $id)->find();
                $fm_img_re = Db::name('video_small')->field('fm_img,url,rec_fm_img,video_time,m3u8_time,status')->where(array('id' => $id))->find();
                if ($title_re) {
                    $result['code'] = 1;
                    $result['msg'] = '标题已存在';
                } elseif (!$url) {
                    $result['code'] = 1;
                    $result['msg'] = '视频未上传';
                }elseif($fm_img_re['status']==1){
                    $result['code'] = 1;
                    $result['msg'] = '已发布视频不允许修改';
                } else {
                    if (!$fm_img || $fm_img == '') {
                        $result['code'] = 1;
                        $result['msg'] = '未上传图片';
                    } elseif (strtotime($time_free) > time() && (!$rec_title || $rec_title == '')) {
                        $result['code'] = 1;
                        $result['msg'] = '未填写限时推荐标题';
                    } elseif (strtotime($time_free) > time() && (!$rec_fm_img || $rec_fm_img == '')) {
                        $result['code'] = 1;
                        $result['msg'] = '未上传限时推荐封面图片';
                    } else {
                        if ($uid) {
                            $user_re = Db::name('user')->field('name,path,type,column_id')->where(array('id' => $uid,'type'=>2))->find();
                            $editor_status = 2;
                            if($user_re && $user_re['type']==2){
                                $editor_status=1;
                                $author_str = $user_re['name'];
                                $path_str = $user_re['path'];
                            }
                            if ($editor_status == 1) {
                                $arr = [
                                    'title' => $title,
                                    'rec_title' => $rec_title,
                                    'video_id' => $video_id,
                                    'memo' => $memo,
                                    'column_id' => $user_re['column_id'],
                                    'address_id' => $address_id,
                                    'video_time_id' => $video_time_id,
                                    'tag' => $tag,
                                    'vip_status' => $vip_status,
                                    'language' => $language,
                                    'time_free' => strtotime($time_free),
                                    'uid' => $uid,
                                    'url' => $url,
                                    'recommend_status' => $recommend_status,
                                    'cate_id' => $cate_id,
                                    'status' => $status,
                                    'fm_img' => $fm_img,
                                    'rec_fm_img' => $rec_fm_img,
                                    'video_time' => $video_time,
                                    'author' => $author_str,
                                    'author_path' => $path_str,
                                    'sort' => $sort,
                                    'edit_time' => time(),
                                    'm3u8_time' => $m3u8_time,
                                ];
                                $res = Db::name('video_small')->where(array('id' => $id,'uid'=>session('qm_ad_uid')))->update($arr);
                                if ($res) {
                                    if($fm_img_re['fm_img']){
                                        $upload->del_file($fm_img_re['fm_img'], $fm_img);
                                    }
                                    if($fm_img_re['rec_fm_img']){
                                        $upload->del_file($fm_img_re['rec_fm_img'], $rec_fm_img);
                                    }
                                    $result['code'] = 0;
                                    $result['msg'] = '修改视频成功';
                                    $index = new \app\admin\model\Index();
                                    $index->set_video_info($id);
                                } else {
                                    $upload->del_file($fm_img_re['fm_img'], $fm_img, 2);
                                    $upload->del_file($fm_img_re['rec_fm_img'], $rec_fm_img, 2);
                                    $upload->del_file($fm_img_re['url'], $url, 2);
                                    $result['code'] = 1;
                                    $result['msg'] = '修改视频失败';
                                }
                            } else {
                                $result['code'] = 1;
                                $result['msg'] = '发布人不是编辑权限';
                            }
                        } else {
                            $result['code'] = 1;
                            $result['msg'] = '请登录';
                        }

                    }
                }

            }
        } else {
            $result['code'] = 1;
            $result['msg'] = '修改视频失败';
        }
        echo json_encode($result);
    }

    //删除视频
    public function del_video_small()
    {
        exit();
        if (request()->isPost()) {
            $id = input('post.id');
            $id_arr = explode(',', $id);
            $id_arr = array_filter($id_arr);
            $access_token = input('post.access_token');
            $upload = new \app\admin\model\Upload();
            if (!$id_arr) {
                $result['code'] = 1;
                $result['msg'] = '请选择需要删除的视频';
            } else {
                foreach ($id_arr as $k => $v) {
                    $video_re = Db::name('video_small')->field('fm_img,url,uid,video_time,m3u8_time')->where(array('id' => $id_arr[$k],'uid'=>session('qm_ad_uid')))->find();
                    $res = Db::name('video_small')->where(array('id' => $id_arr[$k],'uid'=>session('qm_ad_uid')))->delete();
                    if ($res) {
                        Db::name('user')->where('id', session('qm_ad_uid'))->setDec('video_num', 1);
                        $path = str_replace('\\', '/', $video_re['fm_img']);
                        $upload->del_file('', $path);
                    }
                }
                $result['code'] = 0;
                $result['msg'] = '删除视频成功';
            }
        } else {
            $result['code'] = 1;
            $result['msg'] = '删除视频失败';
        }
        echo json_encode($result);
    }


//上传电影封面图片
    public function upload_videoimg()
    {
        $upload = new \app\admin\model\Upload();
        $result = $upload->upload(serialize($_FILES), 'image', '/uploads/video_fm');
        echo $result;
    }
    //上传电影
    public function upload_video()
    {
        set_time_limit(0);
        $upload = new \app\admin\model\Upload();
        $result = $upload->upload(serialize($_FILES), 'video', '/uploads/video');
        echo $result;
    }
}
